# web路由文件
from django.contrib import admin
from django.urls import path, include
from web.views import index, cart, orders

urlpatterns = [
    # path('admin/', admin.site.urls),
    path('', index.index, name='index'),

    # 登录请求
    path('login/', index.login, name='web_login'),
    path('dologin/', index.dologin, name='web_dologin'),
    path('logout/', index.logout, name='web_logout'),
    path('verify/', index.verify, name='web_verify'),

    # 为web端的url请求加web前缀， 带前缀的地址必须登录才可以访问
    path('web/', include([
        path('', index.web_index, name='web_index'),

        # 购物车
        path('cart/add/<str:pid>/', cart.add, name='web_cart_add'),
        path('cart/delete/<str:pid>/', cart.delete, name='web_cart_delete'),
        path('cart/clear/', cart.clear, name='web_cart_clear'),
        path('cart/change/', cart.change, name='web_cart_change'),

        # 订单信息
        path('orders/<int:pIndex>/', orders.index, name='web_orders_index'),
        path('orders/insert/', orders.insert, name='web_orders_insert'),
        path('orders/detail/', orders.detail, name='web_orders_detail'),
        path('orders/status/', orders.status, name='web_orders_status'),
    ])),
]
